package com.yyj.dao;

import com.yyj.entity.Pet;
import com.yyj.entity.Params;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface PetDao {
    List<Pet> getPet();
    List<Pet> getBySearch(@Param("params") Params params);
    @Insert("insert into pet(name,image,variety,age,address,description,originalOwnerId,chat,species,currentTime,status) values (#{name},#{image},#{variety},#{age},#{address},#{description},#{originalOwnerId},#{chat},#{species},now(),'待领养')")
    void insertPet(Pet pet);
    @Update("update pet set name=#{name},image=#{image},variety=#{variety},age=#{age},address=#{address},description=#{description},originalOwnerId=#{originalOwnerId},chat=#{chat},species=#{species},currentTime=now() where petId=#{petId}")
    void updatePet(Pet pet);
    @Delete("delete from pet where petId=#{petId}")
    void deletePet(Integer petId);
    @Select("select * from pet where petId=#{petId}")
    Pet findById(Integer petId);
}
